<template>
  <div class="person">
    <h2>一辆{{ car.brand }},价值{{ car.price }}</h2>
    <button @click="changePrice">修改汽车价格</button>
    <br>
    <h2>游戏列表</h2>
    <ul>
      <li v-for="(item,index) in games" :key="item.id">
         {{ item.name }}
      </li>
    </ul>
    <button @click="changeFirstGame">修改第一个游戏的名字</button>
  </div>
</template>
<script setup lang="ts" name="Person234">
    import {reactive} from 'vue'
   //数据
   let car = reactive({brand:'奔驰',price:1000})

   let games = reactive([
    {id:'aldjkfladfl01',name:'王者荣耀'},
    {id:'aldjkfladfl02',name:'悟空'},
    {id:'aldjkfladfl03',name:'LOL'},
   ])

   function changePrice(){
      car.price = 999
   }

   function changeFirstGame(){
      games[0].name = '流星蝴蝶剑'
   }

</script>
<style scoped>
  .person{
      background-color: skyblue;
      box-shadow: 0 0 10px;
      border-radius: 10px;
      padding: 20px;
  }

  button{
    margin: 0 5px;
  }

  li{
    font-size: 20px;
  }


</style>